<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class WIN32OLE - win32ole: Ruby Standard Library Documentation</title>


<script src="./js/navigation.js" defer></script>
<script src="./js/search.js" defer></script>
<script src="./js/search_index.js" defer></script>
<script src="./js/searcher.js" defer></script>
<script src="./js/darkfish.js" defer></script>

<script src="./js/jquery-3.2.0.min.js"></script>

<script src="./js/vue.min.js"></script>
<script src="./js/js.cookie.min.js"></script>

<link href="./css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="./css/rdoc.css" rel="stylesheet">
<link href="./css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
  var index_rel_prefix = "./";
  var darkModeCsseHref = "./css/rdoc-dm.css"
  var defaultModeCssHref = "./css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="./index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="./table_of_contents.html#pages">Pages</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-codepage">::codepage</a>
    <li ><a href="#method-c-codepage-3D">::codepage=</a>
    <li ><a href="#method-c-connect">::connect</a>
    <li ><a href="#method-c-const_load">::const_load</a>
    <li ><a href="#method-c-create_guid">::create_guid</a>
    <li ><a href="#method-c-locale">::locale</a>
    <li ><a href="#method-c-locale-3D">::locale=</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-c-ole_free">::ole_free</a>
    <li ><a href="#method-c-ole_reference_count">::ole_reference_count</a>
    <li ><a href="#method-c-ole_show_help">::ole_show_help</a>
    <li ><a href="#method-i-5B-5D">#[]</a>
    <li ><a href="#method-i-5B-5D-3D">#[]=</a>
    <li ><a href="#method-i-_getproperty">#_getproperty</a>
    <li ><a href="#method-i-_invoke">#_invoke</a>
    <li ><a href="#method-i-_setproperty">#_setproperty</a>
    <li ><a href="#method-i-each">#each</a>
    <li ><a href="#method-i-invoke">#invoke</a>
    <li ><a href="#method-i-method_missing">#method_missing</a>
    <li class="calls-super" ><a href="#method-i-methods">#methods</a>
    <li ><a href="#method-i-ole_activex_initialize">#ole_activex_initialize</a>
    <li ><a href="#method-i-ole_free">#ole_free</a>
    <li ><a href="#method-i-ole_func_methods">#ole_func_methods</a>
    <li ><a href="#method-i-ole_get_methods">#ole_get_methods</a>
    <li ><a href="#method-i-ole_method">#ole_method</a>
    <li ><a href="#method-i-ole_method_help">#ole_method_help</a>
    <li ><a href="#method-i-ole_methods">#ole_methods</a>
    <li ><a href="#method-i-ole_methods_safely">#ole_methods_safely</a>
    <li ><a href="#method-i-ole_obj_help">#ole_obj_help</a>
    <li ><a href="#method-i-ole_put_methods">#ole_put_methods</a>
    <li ><a href="#method-i-ole_query_interface">#ole_query_interface</a>
    <li ><a href="#method-i-ole_respond_to-3F">#ole_respond_to?</a>
    <li ><a href="#method-i-ole_type">#ole_type</a>
    <li ><a href="#method-i-ole_typelib">#ole_typelib</a>
    <li ><a href="#method-i-setproperty">#setproperty</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-WIN32OLE">
    <h1 id="class-WIN32OLE" class="class">
      class WIN32OLE
    </h1>

    <section class="description">
    
<p><a href="WIN32OLE.html"><code>WIN32OLE</code></a></p>

<p><code>WIN32OLE</code> objects represent OLE Automation object in Ruby.</p>

<p>By using <a href="WIN32OLE.html"><code>WIN32OLE</code></a>, you can access OLE server like VBScript.</p>

<p>Here is sample script.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;win32ole&#39;</span>

<span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">excel</span>.<span class="ruby-identifier">visible</span> = <span class="ruby-keyword">true</span>
<span class="ruby-identifier">workbook</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-constant">Workbooks</span>.<span class="ruby-constant">Add</span>();
<span class="ruby-identifier">worksheet</span> = <span class="ruby-identifier">workbook</span>.<span class="ruby-constant">Worksheets</span>(<span class="ruby-value">1</span>);
<span class="ruby-identifier">worksheet</span>.<span class="ruby-constant">Range</span>(<span class="ruby-string">&quot;A1:D1&quot;</span>).<span class="ruby-identifier">value</span> = [<span class="ruby-string">&quot;North&quot;</span>,<span class="ruby-string">&quot;South&quot;</span>,<span class="ruby-string">&quot;East&quot;</span>,<span class="ruby-string">&quot;West&quot;</span>];
<span class="ruby-identifier">worksheet</span>.<span class="ruby-constant">Range</span>(<span class="ruby-string">&quot;A2:B2&quot;</span>).<span class="ruby-identifier">value</span> = [<span class="ruby-value">5.2</span>, <span class="ruby-value">10</span>];
<span class="ruby-identifier">worksheet</span>.<span class="ruby-constant">Range</span>(<span class="ruby-string">&quot;C2&quot;</span>).<span class="ruby-identifier">value</span> = <span class="ruby-value">8</span>;
<span class="ruby-identifier">worksheet</span>.<span class="ruby-constant">Range</span>(<span class="ruby-string">&quot;D2&quot;</span>).<span class="ruby-identifier">value</span> = <span class="ruby-value">20</span>;

<span class="ruby-identifier">range</span> = <span class="ruby-identifier">worksheet</span>.<span class="ruby-constant">Range</span>(<span class="ruby-string">&quot;A1:D2&quot;</span>);
<span class="ruby-identifier">range</span>.<span class="ruby-identifier">select</span>
<span class="ruby-identifier">chart</span> = <span class="ruby-identifier">workbook</span>.<span class="ruby-constant">Charts</span>.<span class="ruby-constant">Add</span>;

<span class="ruby-identifier">workbook</span>.<span class="ruby-identifier">saved</span> = <span class="ruby-keyword">true</span>;

<span class="ruby-identifier">excel</span>.<span class="ruby-constant">ActiveWorkbook</span>.<span class="ruby-constant">Close</span>(<span class="ruby-value">0</span>);
<span class="ruby-identifier">excel</span>.<span class="ruby-constant">Quit</span>();
</pre>

<p>Unfortunately, Win32OLE doesn’t support the argument passed by reference directly. Instead, Win32OLE provides <a href="WIN32OLE.html#ARGV"><code>WIN32OLE::ARGV</code></a> or WIN32OLE_VARIANT object. If you want to get the result value of argument passed by reference, you can use <a href="WIN32OLE.html#ARGV"><code>WIN32OLE::ARGV</code></a> or WIN32OLE_VARIANT.</p>

<pre class="ruby"><span class="ruby-identifier">oleobj</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">arg1</span>, <span class="ruby-identifier">arg2</span>, <span class="ruby-identifier">refargv3</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-constant">WIN32OLE</span><span class="ruby-operator">::</span><span class="ruby-constant">ARGV</span>[<span class="ruby-value">2</span>]   <span class="ruby-comment"># the value of refargv3 after called oleobj.method</span>
</pre>

<p>or</p>

<pre class="ruby"><span class="ruby-identifier">refargv3</span> = <span class="ruby-constant">WIN32OLE_VARIANT</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">XXX</span>,
            <span class="ruby-constant">WIN32OLE</span><span class="ruby-operator">::</span><span class="ruby-constant">VARIANT</span><span class="ruby-operator">::</span><span class="ruby-constant">VT_BYREF</span><span class="ruby-operator">|</span><span class="ruby-constant">WIN32OLE</span><span class="ruby-operator">::</span><span class="ruby-constant">VARIANT</span><span class="ruby-operator">::</span><span class="ruby-constant">VT_XXX</span>)
<span class="ruby-identifier">oleobj</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">arg1</span>, <span class="ruby-identifier">arg2</span>, <span class="ruby-identifier">refargv3</span>)
<span class="ruby-identifier">p</span> <span class="ruby-identifier">refargv3</span>.<span class="ruby-identifier">value</span> <span class="ruby-comment"># the value of refargv3 after called oleobj.method.</span>
</pre>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="ARGV">ARGV
          <dd><p>After invoking OLE methods with reference arguments, you can access the value of arguments by using <a href="WIN32OLE.html#ARGV"><code>ARGV</code></a>.</p>

<p>If the method of OLE(COM) server written by C#.NET is following:</p>

<pre>void calcsum(int a, int b, out int c) {
    c = a + b;
}</pre>

<p>then, the Ruby OLE(COM) client script to retrieve the value of argument c after invoking calcsum method is following:</p>

<pre class="ruby"><span class="ruby-identifier">a</span> = <span class="ruby-value">10</span>
<span class="ruby-identifier">b</span> = <span class="ruby-value">20</span>
<span class="ruby-identifier">c</span> = <span class="ruby-value">0</span>
<span class="ruby-identifier">comserver</span>.<span class="ruby-identifier">calcsum</span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>, <span class="ruby-identifier">c</span>)
<span class="ruby-identifier">p</span> <span class="ruby-identifier">c</span> <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-identifier">p</span> <span class="ruby-constant">WIN32OLE</span><span class="ruby-operator">::</span><span class="ruby-constant">ARGV</span> <span class="ruby-comment"># =&gt; [10, 20, 30]</span>
</pre>

<p>You can use WIN32OLE_VARIANT object to retrieve the value of reference arguments instead of referring <a href="WIN32OLE.html#ARGV"><code>WIN32OLE::ARGV</code></a>.</p>
          <dt id="CP_ACP">CP_ACP
          <dd><p>ANSI code page. See <a href="WIN32OLE.html#method-c-codepage"><code>WIN32OLE.codepage</code></a> and <a href="WIN32OLE.html#method-c-codepage-3D"><code>WIN32OLE.codepage=</code></a>.</p>
          <dt id="CP_MACCP">CP_MACCP
          <dd><p>2</p>
          <dt id="CP_OEMCP">CP_OEMCP
          <dd><p>OEM code page. See <a href="WIN32OLE.html#method-c-codepage"><code>WIN32OLE.codepage</code></a> and <a href="WIN32OLE.html#method-c-codepage-3D"><code>WIN32OLE.codepage=</code></a>.</p>
          <dt id="CP_SYMBOL">CP_SYMBOL
          <dd><p>symbol code page. See <a href="WIN32OLE.html#method-c-codepage"><code>WIN32OLE.codepage</code></a> and <a href="WIN32OLE.html#method-c-codepage-3D"><code>WIN32OLE.codepage=</code></a>.</p>
          <dt id="CP_THREAD_ACP">CP_THREAD_ACP
          <dd><p>current thread ANSI code page. See <a href="WIN32OLE.html#method-c-codepage"><code>WIN32OLE.codepage</code></a> and <a href="WIN32OLE.html#method-c-codepage-3D"><code>WIN32OLE.codepage=</code></a>.</p>
          <dt id="CP_UTF7">CP_UTF7
          <dd><p>UTF-7 code page. See <a href="WIN32OLE.html#method-c-codepage"><code>WIN32OLE.codepage</code></a> and <a href="WIN32OLE.html#method-c-codepage-3D"><code>WIN32OLE.codepage=</code></a>.</p>
          <dt id="CP_UTF8">CP_UTF8
          <dd><p>UTF-8 code page. See <a href="WIN32OLE.html#method-c-codepage"><code>WIN32OLE.codepage</code></a> and <a href="WIN32OLE.html#method-c-codepage-3D"><code>WIN32OLE.codepage=</code></a>.</p>
          <dt id="LOCALE_SYSTEM_DEFAULT">LOCALE_SYSTEM_DEFAULT
          <dd><p>default locale for the operating system. See <a href="WIN32OLE.html#method-c-locale"><code>WIN32OLE.locale</code></a> and <a href="WIN32OLE.html#method-c-locale-3D"><code>WIN32OLE.locale=</code></a>.</p>
          <dt id="LOCALE_USER_DEFAULT">LOCALE_USER_DEFAULT
          <dd><p>default locale for the user or process. See <a href="WIN32OLE.html#method-c-locale"><code>WIN32OLE.locale</code></a> and <a href="WIN32OLE.html#method-c-locale-3D"><code>WIN32OLE.locale=</code></a>.</p>
          <dt id="VERSION">VERSION
          <dd><p>Version string of <a href="WIN32OLE.html"><code>WIN32OLE</code></a>.</p>
        </dl>
        </section>



                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-codepage" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          codepage
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns current codepage.</p>

<pre class="ruby"><span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">codepage</span> <span class="ruby-comment"># =&gt; WIN32OLE::CP_ACP</span>
</pre>

                              <div class="method-source-code" id="codepage-source">
            <pre>static VALUE
fole_s_get_code_page(VALUE self)
{
    return RB_INT2FIX(cWIN32OLE_cp);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-codepage-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          codepage = CP
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets current codepage. The <a href="WIN32OLE.html#method-c-codepage"><code>WIN32OLE.codepage</code></a> is initialized according to Encoding.default_internal. If Encoding.default_internal is nil then <a href="WIN32OLE.html#method-c-codepage"><code>WIN32OLE.codepage</code></a> is initialized according to Encoding.default_external.</p>

<pre class="ruby"><span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">codepage</span> = <span class="ruby-constant">WIN32OLE</span><span class="ruby-operator">::</span><span class="ruby-constant">CP_UTF8</span>
<span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">codepage</span> = <span class="ruby-value">65001</span>
</pre>

                              <div class="method-source-code" id="codepage-3D-source">
            <pre>static VALUE
fole_s_set_code_page(VALUE self, VALUE vcp)
{
    UINT cp = RB_FIX2INT(vcp);
    set_ole_codepage(cp);
    /*
     * Should this method return old codepage?
     */
    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-connect" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          connect( ole ) -&rarr; aWIN32OLE
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns running OLE Automation object or <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object from moniker. 1st argument should be OLE program id or class id or moniker.</p>

<pre class="ruby"><span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">connect</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>) <span class="ruby-comment"># =&gt; WIN32OLE object which represents running Excel.</span>
</pre>

                              <div class="method-source-code" id="connect-source">
            <pre>static VALUE
fole_s_connect(int argc, VALUE *argv, VALUE self)
{
    VALUE svr_name;
    VALUE others;
    HRESULT hr;
    CLSID   clsid;
    OLECHAR *pBuf;
    IDispatch *pDispatch;
    void *p;
    IUnknown *pUnknown;

    /* initialize to use OLE */
    ole_initialize();

    rb_scan_args(argc, argv, &quot;1*&quot;, &amp;svr_name, &amp;others);
    StringValue(svr_name);

    /* get CLSID from OLE server name */
    pBuf = ole_vstr2wc(svr_name);
    hr = CLSIDFromProgID(pBuf, &amp;clsid);
    if(FAILED(hr)) {
        hr = CLSIDFromString(pBuf, &amp;clsid);
    }
    SysFreeString(pBuf);
    if(FAILED(hr)) {
        return ole_bind_obj(svr_name, argc, argv, self);
    }

    hr = GetActiveObject(&amp;clsid, 0, &amp;pUnknown);
    if (FAILED(hr)) {
        ole_raise(hr, eWIN32OLERuntimeError,
                  &quot;OLE server `%s&#39; not running&quot;, StringValuePtr(svr_name));
    }
    hr = pUnknown-&gt;lpVtbl-&gt;QueryInterface(pUnknown, &amp;IID_IDispatch, &amp;p);
    pDispatch = p;
    if(FAILED(hr)) {
        OLE_RELEASE(pUnknown);
        ole_raise(hr, eWIN32OLERuntimeError,
                  &quot;failed to create WIN32OLE server `%s&#39;&quot;,
                  StringValuePtr(svr_name));
    }

    OLE_RELEASE(pUnknown);

    return create_win32ole_object(self, pDispatch, argc, argv);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-const_load" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          const_load( ole, mod = WIN32OLE)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Defines the constants of OLE Automation server as mod’s constants. The first argument is <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object or type library name. If 2nd argument is omitted, the default is <a href="WIN32OLE.html"><code>WIN32OLE</code></a>. The first letter of Ruby’s constant variable name is upper case, so constant variable name of <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object is capitalized. For example, the ‘xlTop’ constant of Excel is changed to ‘XlTop’ in <a href="WIN32OLE.html"><code>WIN32OLE</code></a>. If the first letter of constant variable is not [A-Z], then the constant is defined as CONSTANTS hash element.</p>

<pre class="ruby"><span class="ruby-keyword">module</span> <span class="ruby-constant">EXCEL_CONST</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">const_load</span>(<span class="ruby-identifier">excel</span>, <span class="ruby-constant">EXCEL_CONST</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-constant">EXCEL_CONST</span><span class="ruby-operator">::</span><span class="ruby-constant">XlTop</span> <span class="ruby-comment"># =&gt; -4160</span>
<span class="ruby-identifier">puts</span> <span class="ruby-constant">EXCEL_CONST</span><span class="ruby-operator">::</span><span class="ruby-constant">CONSTANTS</span>[<span class="ruby-string">&#39;_xlDialogChartSourceData&#39;</span>] <span class="ruby-comment"># =&gt; 541</span>

<span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">const_load</span>(<span class="ruby-identifier">excel</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-constant">WIN32OLE</span><span class="ruby-operator">::</span><span class="ruby-constant">XlTop</span> <span class="ruby-comment"># =&gt; -4160</span>

<span class="ruby-keyword">module</span> <span class="ruby-constant">MSO</span>
<span class="ruby-keyword">end</span>
<span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">const_load</span>(<span class="ruby-string">&#39;Microsoft Office 9.0 Object Library&#39;</span>, <span class="ruby-constant">MSO</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-constant">MSO</span><span class="ruby-operator">::</span><span class="ruby-constant">MsoLineSingle</span> <span class="ruby-comment"># =&gt; 1</span>
</pre>

                              <div class="method-source-code" id="const_load-source">
            <pre>static VALUE
fole_s_const_load(int argc, VALUE *argv, VALUE self)
{
    VALUE ole;
    VALUE klass;
    struct oledata *pole = NULL;
    ITypeInfo *pTypeInfo;
    ITypeLib *pTypeLib;
    unsigned int index;
    HRESULT hr;
    OLECHAR *pBuf;
    VALUE file;
    LCID    lcid = cWIN32OLE_lcid;

    rb_scan_args(argc, argv, &quot;11&quot;, &amp;ole, &amp;klass);
    if (!RB_TYPE_P(klass, T_CLASS) &amp;&amp;
        !RB_TYPE_P(klass, T_MODULE) &amp;&amp;
        !RB_TYPE_P(klass, T_NIL)) {
        rb_raise(rb_eTypeError, &quot;2nd parameter must be Class or Module&quot;);
    }
    if (rb_obj_is_kind_of(ole, cWIN32OLE)) {
        pole = oledata_get_struct(ole);
        hr = pole-&gt;pDispatch-&gt;lpVtbl-&gt;GetTypeInfo(pole-&gt;pDispatch,
                                                  0, lcid, &amp;pTypeInfo);
        if(FAILED(hr)) {
            ole_raise(hr, eWIN32OLEQueryInterfaceError, &quot;failed to GetTypeInfo&quot;);
        }
        hr = pTypeInfo-&gt;lpVtbl-&gt;GetContainingTypeLib(pTypeInfo, &amp;pTypeLib, &amp;index);
        if(FAILED(hr)) {
            OLE_RELEASE(pTypeInfo);
            ole_raise(hr, eWIN32OLEQueryInterfaceError, &quot;failed to GetContainingTypeLib&quot;);
        }
        OLE_RELEASE(pTypeInfo);
        if(!RB_TYPE_P(klass, T_NIL)) {
            ole_const_load(pTypeLib, klass, self);
        }
        else {
            ole_const_load(pTypeLib, cWIN32OLE, self);
        }
        OLE_RELEASE(pTypeLib);
    }
    else if(RB_TYPE_P(ole, T_STRING)) {
        file = typelib_file(ole);
        if (file == Qnil) {
            file = ole;
        }
        pBuf = ole_vstr2wc(file);
        hr = LoadTypeLibEx(pBuf, REGKIND_NONE, &amp;pTypeLib);
        SysFreeString(pBuf);
        if (FAILED(hr))
          ole_raise(hr, eWIN32OLERuntimeError, &quot;failed to LoadTypeLibEx&quot;);
        if(!RB_TYPE_P(klass, T_NIL)) {
            ole_const_load(pTypeLib, klass, self);
        }
        else {
            ole_const_load(pTypeLib, cWIN32OLE, self);
        }
        OLE_RELEASE(pTypeLib);
    }
    else {
        rb_raise(rb_eTypeError, &quot;1st parameter must be WIN32OLE instance&quot;);
    }
    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-create_guid" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          create_guid
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates GUID.</p>

<pre class="ruby"><span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">create_guid</span> <span class="ruby-comment"># =&gt; {1CB530F1-F6B1-404D-BCE6-1959BF91F4A8}</span>
</pre>

                              <div class="method-source-code" id="create_guid-source">
            <pre>static VALUE
fole_s_create_guid(VALUE self)
{
    GUID guid;
    HRESULT hr;
    OLECHAR bstr[80];
    int len = 0;
    hr = CoCreateGuid(&amp;guid);
    if (FAILED(hr)) {
        ole_raise(hr, eWIN32OLERuntimeError, &quot;failed to create GUID&quot;);
    }
    len = StringFromGUID2(&amp;guid, bstr, sizeof(bstr)/sizeof(OLECHAR));
    if (len == 0) {
        rb_raise(rb_eRuntimeError, &quot;failed to create GUID(buffer over)&quot;);
    }
    return ole_wc2vstr(bstr, FALSE);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-locale" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          locale &rarr; locale id.
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns current locale id (lcid). The default locale is <a href="WIN32OLE.html#LOCALE_SYSTEM_DEFAULT"><code>WIN32OLE::LOCALE_SYSTEM_DEFAULT</code></a>.</p>

<pre class="ruby"><span class="ruby-identifier">lcid</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">locale</span>
</pre>

                              <div class="method-source-code" id="locale-source">
            <pre>static VALUE
fole_s_get_locale(VALUE self)
{
    return RB_INT2FIX(cWIN32OLE_lcid);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-locale-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          locale = lcid
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets current locale id (lcid).</p>

<pre class="ruby"><span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">locale</span> = <span class="ruby-value">1033</span> <span class="ruby-comment"># set locale English(U.S)</span>
<span class="ruby-identifier">obj</span> = <span class="ruby-constant">WIN32OLE_VARIANT</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;$100,000&quot;</span>, <span class="ruby-constant">WIN32OLE</span><span class="ruby-operator">::</span><span class="ruby-constant">VARIANT</span><span class="ruby-operator">::</span><span class="ruby-constant">VT_CY</span>)
</pre>

                              <div class="method-source-code" id="locale-3D-source">
            <pre>static VALUE
fole_s_set_locale(VALUE self, VALUE vlcid)
{
    LCID lcid = RB_FIX2INT(vlcid);
    if (lcid_installed(lcid)) {
        cWIN32OLE_lcid = lcid;
    } else {
        switch (lcid) {
        case LOCALE_SYSTEM_DEFAULT:
        case LOCALE_USER_DEFAULT:
            cWIN32OLE_lcid = lcid;
            break;
        default:
            rb_raise(eWIN32OLERuntimeError, &quot;not installed locale: %u&quot;, (unsigned int)lcid);
        }
    }
    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          new(server, [host]) &rarr; WIN32OLE object
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          new(server, license: &#39;key&#39;) &rarr; WIN32OLE object
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object(OLE Automation object). The first argument server specifies OLE Automation server. The first argument should be CLSID or PROGID. If second argument host specified, then returns OLE Automation object on host. If :license keyword argument is provided, IClassFactory2::CreateInstanceLic is used to create instance of licensed server.</p>

<pre class="ruby"><span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>) <span class="ruby-comment"># =&gt; Excel OLE Automation WIN32OLE object.</span>
<span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;{00024500-0000-0000-C000-000000000046}&#39;</span>) <span class="ruby-comment"># =&gt; Excel OLE Automation WIN32OLE object.</span>
</pre>

                              <div class="method-source-code" id="new-source">
            <pre>static VALUE
fole_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE svr_name;
    VALUE host;
    VALUE others;
    VALUE opts;
    HRESULT hr;
    CLSID   clsid;
    OLECHAR *pBuf;
    OLECHAR *key_buf;
    IDispatch *pDispatch;
    IClassFactory2 * pIClassFactory2;
    void *p;
    static ID keyword_ids[1];
    VALUE kwargs[1];

    rb_call_super(0, 0);
    rb_scan_args(argc, argv, &quot;11*:&quot;, &amp;svr_name, &amp;host, &amp;others, &amp;opts);

    StringValue(svr_name);
    if (!NIL_P(host)) {
        StringValue(host);
        return ole_create_dcom(self, svr_name, host, others);
    }

    /* get CLSID from OLE server name */
    pBuf  = ole_vstr2wc(svr_name);
    hr = CLSIDFromProgID(pBuf, &amp;clsid);
    if(FAILED(hr)) {
        hr = CLSIDFromString(pBuf, &amp;clsid);
    }
    SysFreeString(pBuf);
    if(FAILED(hr)) {
        ole_raise(hr, eWIN32OLERuntimeError,
                  &quot;unknown OLE server: `%s&#39;&quot;,
                  StringValuePtr(svr_name));
    }

    if (!keyword_ids[0]) {
        keyword_ids[0] = rb_intern_const(&quot;license&quot;);
    }
    rb_get_kwargs(opts, keyword_ids, 0, 1, kwargs);

    if (kwargs[0] == Qundef) {
        /* get IDispatch interface */
        hr = CoCreateInstance(
            &amp;clsid,
            NULL,
            CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
            &amp;IID_IDispatch,
            &amp;p
        );
    } else {
        hr = CoGetClassObject(
            &amp;clsid,
            CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
            NULL,
            &amp;IID_IClassFactory2,
            (LPVOID)&amp;pIClassFactory2
        );
        if (hr == S_OK) {
            key_buf = ole_vstr2wc(kwargs[0]);
            hr = pIClassFactory2-&gt;lpVtbl-&gt;CreateInstanceLic(pIClassFactory2, NULL, NULL, &amp;IID_IDispatch, key_buf, &amp;p);
            SysFreeString(key_buf);
            OLE_RELEASE(pIClassFactory2);
        }
    }
    if(FAILED(hr)) {
        ole_raise(hr, eWIN32OLERuntimeError,
                  &quot;failed to create WIN32OLE object from `%s&#39;&quot;,
                  StringValuePtr(svr_name));
    }
    pDispatch = p;

    ole_set_member(self, pDispatch);
    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ole_free" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          ole_free(aWIN32OLE) -&rarr; number
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Invokes Release method of Dispatch interface of <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object. You should not use this method because this method exists only for debugging <a href="WIN32OLE.html"><code>WIN32OLE</code></a>. The return value is reference counter of OLE object.</p>

                              <div class="method-source-code" id="ole_free-source">
            <pre>static VALUE
fole_s_free(VALUE self, VALUE obj)
{
    ULONG n = 0;
    struct oledata * pole = NULL;
    pole = oledata_get_struct(obj);
    if(pole-&gt;pDispatch) {
        if (reference_count(pole) &gt; 0) {
            n = OLE_RELEASE(pole-&gt;pDispatch);
        }
    }
    return RB_INT2NUM(n);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ole_reference_count" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          ole_reference_count(aWIN32OLE) -&rarr; number
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns reference counter of Dispatch interface of <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object. You should not use this method because this method exists only for debugging <a href="WIN32OLE.html"><code>WIN32OLE</code></a>.</p>

                              <div class="method-source-code" id="ole_reference_count-source">
            <pre>static VALUE
fole_s_reference_count(VALUE self, VALUE obj)
{
    struct oledata * pole = NULL;
    pole = oledata_get_struct(obj);
    return RB_INT2NUM(reference_count(pole));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ole_show_help" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          ole_show_help(obj [,helpcontext])
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Displays helpfile. The 1st argument specifies WIN32OLE_TYPE object or WIN32OLE_METHOD object or helpfile.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">typeobj</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">ole_type</span>
<span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">ole_show_help</span>(<span class="ruby-identifier">typeobj</span>)
</pre>

                              <div class="method-source-code" id="ole_show_help-source">
            <pre>static VALUE
fole_s_show_help(int argc, VALUE *argv, VALUE self)
{
    VALUE target;
    VALUE helpcontext;
    VALUE helpfile;
    VALUE name;
    HWND  hwnd;
    rb_scan_args(argc, argv, &quot;11&quot;, &amp;target, &amp;helpcontext);
    if (rb_obj_is_kind_of(target, cWIN32OLE_TYPE) ||
        rb_obj_is_kind_of(target, cWIN32OLE_METHOD)) {
        helpfile = rb_funcall(target, rb_intern(&quot;helpfile&quot;), 0);
        if(strlen(StringValuePtr(helpfile)) == 0) {
            name = rb_ivar_get(target, rb_intern(&quot;name&quot;));
            rb_raise(rb_eRuntimeError, &quot;no helpfile of `%s&#39;&quot;,
                     StringValuePtr(name));
        }
        helpcontext = rb_funcall(target, rb_intern(&quot;helpcontext&quot;), 0);
    } else {
        helpfile = target;
    }
    if (!RB_TYPE_P(helpfile, T_STRING)) {
        rb_raise(rb_eTypeError, &quot;1st parameter must be (String|WIN32OLE_TYPE|WIN32OLE_METHOD)&quot;);
    }
    hwnd = ole_show_help(helpfile, helpcontext);
    if(hwnd == 0) {
        rb_raise(rb_eRuntimeError, &quot;failed to open help file `%s&#39;&quot;,
                 StringValuePtr(helpfile));
    }
    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-5B-5D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE[a1,a2,...]
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the value of Collection specified by a1, a2,.…</p>

<pre class="ruby"><span class="ruby-identifier">dict</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Scripting.Dictionary&#39;</span>)
<span class="ruby-identifier">dict</span>.<span class="ruby-identifier">add</span>(<span class="ruby-string">&#39;ruby&#39;</span>, <span class="ruby-string">&#39;Ruby&#39;</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">dict</span>[<span class="ruby-string">&#39;ruby&#39;</span>] <span class="ruby-comment"># =&gt; &#39;Ruby&#39; (same as `puts dict.item(&#39;ruby&#39;)&#39;)</span>
</pre>

<p>Remark: You can not use this method to get the property.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-comment"># puts excel[&#39;Visible&#39;]  This is error !!!</span>
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">excel</span>.<span class="ruby-constant">Visible</span> <span class="ruby-comment"># You should to use this style to get the property.</span>
</pre>

                              <div class="method-source-code" id="5B-5D-source">
            <pre>static VALUE
fole_getproperty_with_bracket(int argc, VALUE *argv, VALUE self)
{
    VALUE v = ole_invoke(argc, argv, self, DISPATCH_PROPERTYGET, TRUE);
    if (v == rb_eNoMethodError) {
        return rb_call_super(argc, argv);
    }
    return v;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-5B-5D-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE[a1, a2, ...]=val
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets the value to <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object specified by a1, a2, …</p>

<pre class="ruby"><span class="ruby-identifier">dict</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Scripting.Dictionary&#39;</span>)
<span class="ruby-identifier">dict</span>.<span class="ruby-identifier">add</span>(<span class="ruby-string">&#39;ruby&#39;</span>, <span class="ruby-string">&#39;RUBY&#39;</span>)
<span class="ruby-identifier">dict</span>[<span class="ruby-string">&#39;ruby&#39;</span>] = <span class="ruby-string">&#39;Ruby&#39;</span>
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">dict</span>[<span class="ruby-string">&#39;ruby&#39;</span>] <span class="ruby-comment"># =&gt; &#39;Ruby&#39;</span>
</pre>

<p>Remark: You can not use this method to set the property value.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-comment"># excel[&#39;Visible&#39;] = true # This is error !!!</span>
<span class="ruby-identifier">excel</span>.<span class="ruby-constant">Visible</span> = <span class="ruby-keyword">true</span> <span class="ruby-comment"># You should to use this style to set the property.</span>
</pre>

                              <div class="method-source-code" id="5B-5D-3D-source">
            <pre>static VALUE
fole_setproperty_with_bracket(int argc, VALUE *argv, VALUE self)
{
    VALUE v = ole_invoke(argc, argv, self, DISPATCH_PROPERTYPUT, TRUE);
    if (v == rb_eNoMethodError) {
        return rb_call_super(argc, argv);
    }
    return v;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-_getproperty" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#_getproperty(dispid, args, types)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Runs the early binding method to get property. The 1st argument specifies dispatch ID, the 2nd argument specifies the array of arguments, the 3rd argument specifies the array of the type of arguments.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">_getproperty</span>(<span class="ruby-value">558</span>, [], []) <span class="ruby-comment"># same effect as puts excel.visible</span>
</pre>

                              <div class="method-source-code" id="_getproperty-source">
            <pre>static VALUE
fole_getproperty2(VALUE self, VALUE dispid, VALUE args, VALUE types)
{
    return ole_invoke2(self, dispid, args, types, DISPATCH_PROPERTYGET);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-_invoke" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#_invoke(dispid, args, types)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Runs the early binding method. The 1st argument specifies dispatch ID, the 2nd argument specifies the array of arguments, the 3rd argument specifies the array of the type of arguments.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">excel</span>.<span class="ruby-identifier">_invoke</span>(<span class="ruby-value">302</span>, [], []) <span class="ruby-comment">#  same effect as excel.Quit</span>
</pre>

                              <div class="method-source-code" id="_invoke-source">
            <pre>static VALUE
fole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types)
{
    return ole_invoke2(self, dispid, args, types, DISPATCH_METHOD);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-_setproperty" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#_setproperty(dispid, args, types)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Runs the early binding method to set property. The 1st argument specifies dispatch ID, the 2nd argument specifies the array of arguments, the 3rd argument specifies the array of the type of arguments.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">excel</span>.<span class="ruby-identifier">_setproperty</span>(<span class="ruby-value">558</span>, [<span class="ruby-keyword">true</span>], [<span class="ruby-constant">WIN32OLE</span><span class="ruby-operator">::</span><span class="ruby-constant">VARIANT</span><span class="ruby-operator">::</span><span class="ruby-constant">VT_BOOL</span>]) <span class="ruby-comment"># same effect as excel.visible = true</span>
</pre>

                              <div class="method-source-code" id="_setproperty-source">
            <pre>static VALUE
fole_setproperty2(VALUE self, VALUE dispid, VALUE args, VALUE types)
{
    return ole_invoke2(self, dispid, args, types, DISPATCH_PROPERTYPUT);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-each" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#each {|i|...}
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Iterates over each item of OLE collection which has IEnumVARIANT interface.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">book</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">workbooks</span>.<span class="ruby-identifier">add</span>
<span class="ruby-identifier">sheets</span> = <span class="ruby-identifier">book</span>.<span class="ruby-identifier">worksheets</span>(<span class="ruby-value">1</span>)
<span class="ruby-identifier">cells</span> = <span class="ruby-identifier">sheets</span>.<span class="ruby-identifier">cells</span>(<span class="ruby-string">&quot;A1:A5&quot;</span>)
<span class="ruby-identifier">cells</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cell</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">cell</span>.<span class="ruby-identifier">value</span> = <span class="ruby-value">10</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="each-source">
            <pre>static VALUE
fole_each(VALUE self)
{
    LCID    lcid = cWIN32OLE_lcid;

    struct oledata *pole = NULL;

    unsigned int argErr;
    EXCEPINFO excepinfo;
    DISPPARAMS dispParams;
    VARIANT result;
    HRESULT hr;
    IEnumVARIANT *pEnum = NULL;
    void *p;

    RETURN_ENUMERATOR(self, 0, 0);

    VariantInit(&amp;result);
    dispParams.rgvarg = NULL;
    dispParams.rgdispidNamedArgs = NULL;
    dispParams.cNamedArgs = 0;
    dispParams.cArgs = 0;
    memset(&amp;excepinfo, 0, sizeof(excepinfo));

    pole = oledata_get_struct(self);
    hr = pole-&gt;pDispatch-&gt;lpVtbl-&gt;Invoke(pole-&gt;pDispatch, DISPID_NEWENUM,
                                         &amp;IID_NULL, lcid,
                                         DISPATCH_METHOD | DISPATCH_PROPERTYGET,
                                         &amp;dispParams, &amp;result,
                                         &amp;excepinfo, &amp;argErr);

    if (FAILED(hr)) {
        VariantClear(&amp;result);
        ole_raise(hr, eWIN32OLEQueryInterfaceError, &quot;failed to get IEnum Interface&quot;);
    }

    if (V_VT(&amp;result) == VT_UNKNOWN) {
        hr = V_UNKNOWN(&amp;result)-&gt;lpVtbl-&gt;QueryInterface(V_UNKNOWN(&amp;result),
                                                        &amp;IID_IEnumVARIANT,
                                                        &amp;p);
        pEnum = p;
    } else if (V_VT(&amp;result) == VT_DISPATCH) {
        hr = V_DISPATCH(&amp;result)-&gt;lpVtbl-&gt;QueryInterface(V_DISPATCH(&amp;result),
                                                         &amp;IID_IEnumVARIANT,
                                                         &amp;p);
        pEnum = p;
    }
    if (FAILED(hr) || !pEnum) {
        VariantClear(&amp;result);
        ole_raise(hr, eWIN32OLEQueryInterfaceError, &quot;failed to get IEnum Interface&quot;);
    }

    VariantClear(&amp;result);
    rb_ensure(ole_each_sub, (VALUE)pEnum, ole_ienum_free, (VALUE)pEnum);
    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-invoke" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#invoke(method, [arg1,...])  &rarr; return value of method.
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Runs OLE method. The first argument specifies the method name of OLE Automation object. The others specify argument of the <em>method</em>. If you can not execute <em>method</em> directly, then use this method instead.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">excel</span>.<span class="ruby-identifier">invoke</span>(<span class="ruby-string">&#39;Quit&#39;</span>)  <span class="ruby-comment"># =&gt; same as excel.Quit</span>
</pre>

                              <div class="method-source-code" id="invoke-source">
            <pre>static VALUE
fole_invoke(int argc, VALUE *argv, VALUE self)
{
    VALUE v = ole_invoke(argc, argv, self, DISPATCH_METHOD|DISPATCH_PROPERTYGET, FALSE);
    if (v == rb_eNoMethodError) {
        return rb_call_super(argc, argv);
    }
    return v;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-method_missing" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#method_missing(id [,arg1, arg2, ...])
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Calls <a href="WIN32OLE.html#method-i-invoke"><code>WIN32OLE#invoke</code></a> method.</p>

                              <div class="method-source-code" id="method_missing-source">
            <pre>static VALUE
fole_missing(int argc, VALUE *argv, VALUE self)
{
    VALUE mid, org_mid, sym, v;
    const char* mname;
    long n;
    rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
    mid = org_mid = argv[0];
    sym = rb_check_symbol(&amp;mid);
    if (!NIL_P(sym)) mid = rb_sym2str(sym);
    mname = StringValueCStr(mid);
    if(!mname) {
        rb_raise(rb_eRuntimeError, &quot;fail: unknown method or property&quot;);
    }
    n = RSTRING_LEN(mid);
    if(mname[n-1] == &#39;=&#39;) {
        rb_check_arity(argc, 2, 2);
        argv[0] = rb_enc_associate(rb_str_subseq(mid, 0, n-1), cWIN32OLE_enc);

        return ole_propertyput(self, argv[0], argv[1]);
    }
    else {
        argv[0] = rb_enc_associate(rb_str_dup(mid), cWIN32OLE_enc);
        v = ole_invoke(argc, argv, self, DISPATCH_METHOD|DISPATCH_PROPERTYGET, FALSE);
        if (v == rb_eNoMethodError) {
            argv[0] = org_mid;
            return rb_call_super(argc, argv);
        }
        return v;
    }
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-methods" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">methods</span><span
                                class="method-args">(*args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>By overriding Object#methods, <a href="WIN32OLE.html"><code>WIN32OLE</code></a> might work well with did_you_mean gem. This is experimental.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;win32ole&#39;</span>
<span class="ruby-identifier">dict</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Scripting.Dictionary&#39;</span>)
<span class="ruby-identifier">dict</span>.<span class="ruby-constant">Ade</span>(<span class="ruby-string">&#39;a&#39;</span>, <span class="ruby-value">1</span>)
<span class="ruby-comment">#=&gt; Did you mean?  Add</span>
</pre>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  
                              </div>

                              <div class="method-source-code" id="methods-source">
            <pre><span class="ruby-comment"># File win32ole/lib/win32ole.rb, line 21</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">methods</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-keyword">super</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ole_methods_safely</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:name</span>).<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:to_sym</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ole_activex_initialize" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_activex_initialize() &rarr; Qnil
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Initialize <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object(ActiveX Control) by calling IPersistMemory::InitNew.</p>

<p>Before calling OLE method, some kind of the ActiveX controls created with MFC should be initialized by calling IPersistXXX::InitNew.</p>

<p>If and only if you received the exception “HRESULT error code: 0x8000ffff catastrophic failure”, try this method before invoking any ole_method.</p>

<pre>obj = WIN32OLE.new(&quot;ProgID_or_GUID_of_ActiveX_Control&quot;)
obj.ole_activex_initialize
obj.method(...)</pre>

                              <div class="method-source-code" id="ole_activex_initialize-source">
            <pre>static VALUE
fole_activex_initialize(VALUE self)
{
    struct oledata *pole = NULL;
    IPersistMemory *pPersistMemory;
    void *p;

    HRESULT hr = S_OK;

    pole = oledata_get_struct(self);

    hr = pole-&gt;pDispatch-&gt;lpVtbl-&gt;QueryInterface(pole-&gt;pDispatch, &amp;IID_IPersistMemory, &amp;p);
    pPersistMemory = p;
    if (SUCCEEDED(hr)) {
        hr = pPersistMemory-&gt;lpVtbl-&gt;InitNew(pPersistMemory);
        OLE_RELEASE(pPersistMemory);
        if (SUCCEEDED(hr)) {
            return Qnil;
        }
    }

    if (FAILED(hr)) {
        ole_raise(hr, eWIN32OLERuntimeError, &quot;fail to initialize ActiveX control&quot;);
    }

    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ole_free" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_free
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>invokes Release method of Dispatch interface of <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object. Usually, you do not need to call this method because Release method called automatically when <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object garbaged.</p>

                              <div class="method-source-code" id="ole_free-source">
            <pre>static VALUE
fole_free(VALUE self)
{
    struct oledata *pole = NULL;
    pole = oledata_get_struct(self);
    OLE_FREE(pole-&gt;pDispatch);
    pole-&gt;pDispatch = NULL;
    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ole_func_methods" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_func_methods
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the array of WIN32OLE_METHOD object . The element of the array is property (settable) of <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">properties</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">ole_func_methods</span>
</pre>

                              <div class="method-source-code" id="ole_func_methods-source">
            <pre>static VALUE
fole_func_methods(VALUE self)
{
    return ole_methods( self, INVOKE_FUNC);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ole_get_methods" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_get_methods
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the array of WIN32OLE_METHOD object . The element of the array is property (gettable) of <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">properties</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">ole_get_methods</span>
</pre>

                              <div class="method-source-code" id="ole_get_methods-source">
            <pre>static VALUE
fole_get_methods(VALUE self)
{
    return ole_methods( self, INVOKE_PROPERTYGET);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ole_method" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_method_help(method)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns WIN32OLE_METHOD object corresponding with method specified by 1st argument.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">method</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">ole_method_help</span>(<span class="ruby-string">&#39;Quit&#39;</span>)
</pre>

                              <div class="method-source-code" id="ole_method-source">
            <pre>static VALUE
fole_method_help(VALUE self, VALUE cmdname)
{
    ITypeInfo *pTypeInfo;
    HRESULT hr;
    struct oledata *pole = NULL;
    VALUE obj;

    SafeStringValue(cmdname);
    pole = oledata_get_struct(self);
    hr = typeinfo_from_ole(pole, &amp;pTypeInfo);
    if(FAILED(hr))
        ole_raise(hr, eWIN32OLEQueryInterfaceError, &quot;failed to get ITypeInfo&quot;);

    obj = create_win32ole_method(pTypeInfo, cmdname);

    OLE_RELEASE(pTypeInfo);
    if (obj == Qnil)
        rb_raise(eWIN32OLERuntimeError, &quot;not found %s&quot;,
                 StringValuePtr(cmdname));
    return obj;
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="WIN32OLE.html#method-i-ole_method_help">ole_method_help</a>
                            </div>

                          </div>

                  <div id="method-i-ole_method_help" class="method-detail method-alias">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_method_help(method)
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns WIN32OLE_METHOD object corresponding with method specified by 1st argument.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">method</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">ole_method_help</span>(<span class="ruby-string">&#39;Quit&#39;</span>)
</pre>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="WIN32OLE.html#method-i-ole_method">ole_method</a>
                            </div>
                          </div>

                  <div id="method-i-ole_methods" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_methods
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the array of WIN32OLE_METHOD object. The element is OLE method of <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">methods</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">ole_methods</span>
</pre>

                              <div class="method-source-code" id="ole_methods-source">
            <pre>static VALUE
fole_methods(VALUE self)
{
    return ole_methods( self, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ole_obj_help" class="method-detail method-alias">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_type
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns WIN32OLE_TYPE object.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">tobj</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">ole_type</span>
</pre>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="WIN32OLE.html#method-i-ole_type">ole_type</a>
                            </div>
                          </div>

                  <div id="method-i-ole_put_methods" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_put_methods
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the array of WIN32OLE_METHOD object . The element of the array is property (settable) of <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">properties</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">ole_put_methods</span>
</pre>

                              <div class="method-source-code" id="ole_put_methods-source">
            <pre>static VALUE
fole_put_methods(VALUE self)
{
    return ole_methods( self, INVOKE_PROPERTYPUT|INVOKE_PROPERTYPUTREF);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ole_query_interface" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_query_interface(iid) &rarr; WIN32OLE object
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object for a specific dispatch or dual interface specified by iid.</p>

<pre class="ruby"><span class="ruby-identifier">ie</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;InternetExplorer.Application&#39;</span>)
<span class="ruby-identifier">ie_web_app</span> = <span class="ruby-identifier">ie</span>.<span class="ruby-identifier">ole_query_interface</span>(<span class="ruby-string">&#39;{0002DF05-0000-0000-C000-000000000046}&#39;</span>) <span class="ruby-comment"># =&gt; WIN32OLE object for dispinterface IWebBrowserApp</span>
</pre>

                              <div class="method-source-code" id="ole_query_interface-source">
            <pre>static VALUE
fole_query_interface(VALUE self, VALUE str_iid)
{
    HRESULT hr;
    OLECHAR *pBuf;
    IID iid;
    struct oledata *pole = NULL;
    IDispatch *pDispatch;
    void *p;

    pBuf  = ole_vstr2wc(str_iid);
    hr = CLSIDFromString(pBuf, &amp;iid);
    SysFreeString(pBuf);
    if(FAILED(hr)) {
        ole_raise(hr, eWIN32OLERuntimeError,
                  &quot;invalid iid: `%s&#39;&quot;,
                  StringValuePtr(str_iid));
    }

    pole = oledata_get_struct(self);
    if(!pole-&gt;pDispatch) {
        rb_raise(rb_eRuntimeError, &quot;failed to get dispatch interface&quot;);
    }

    hr = pole-&gt;pDispatch-&gt;lpVtbl-&gt;QueryInterface(pole-&gt;pDispatch, &amp;iid,
                                                 &amp;p);
    if(FAILED(hr)) {
        ole_raise(hr, eWIN32OLEQueryInterfaceError,
                  &quot;failed to get interface `%s&#39;&quot;,
                  StringValuePtr(str_iid));
    }

    pDispatch = p;
    return create_win32ole_object(cWIN32OLE, pDispatch, 0, 0);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ole_respond_to-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_respond_to?(method) &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns true when OLE object has OLE method, otherwise returns false.</p>

<pre class="ruby"><span class="ruby-identifier">ie</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;InternetExplorer.Application&#39;</span>)
<span class="ruby-identifier">ie</span>.<span class="ruby-identifier">ole_respond_to?</span>(<span class="ruby-string">&quot;gohome&quot;</span>) <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">true</span>
</pre>

                              <div class="method-source-code" id="ole_respond_to-3F-source">
            <pre>static VALUE
fole_respond_to(VALUE self, VALUE method)
{
    struct oledata *pole = NULL;
    BSTR wcmdname;
    DISPID DispID;
    HRESULT hr;
    if(!RB_TYPE_P(method, T_STRING) &amp;&amp; !RB_TYPE_P(method, T_SYMBOL)) {
        rb_raise(rb_eTypeError, &quot;wrong argument type (expected String or Symbol)&quot;);
    }
    if (RB_TYPE_P(method, T_SYMBOL)) {
        method = rb_sym2str(method);
    }
    pole = oledata_get_struct(self);
    wcmdname = ole_vstr2wc(method);
    hr = pole-&gt;pDispatch-&gt;lpVtbl-&gt;GetIDsOfNames( pole-&gt;pDispatch, &amp;IID_NULL,
            &amp;wcmdname, 1, cWIN32OLE_lcid, &amp;DispID);
    SysFreeString(wcmdname);
    return SUCCEEDED(hr) ? Qtrue : Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ole_type" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_type
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns WIN32OLE_TYPE object.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">tobj</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">ole_type</span>
</pre>

                              <div class="method-source-code" id="ole_type-source">
            <pre>static VALUE
fole_type(VALUE self)
{
    ITypeInfo *pTypeInfo;
    HRESULT hr;
    struct oledata *pole = NULL;
    LCID  lcid = cWIN32OLE_lcid;
    VALUE type = Qnil;

    pole = oledata_get_struct(self);

    hr = pole-&gt;pDispatch-&gt;lpVtbl-&gt;GetTypeInfo( pole-&gt;pDispatch, 0, lcid, &amp;pTypeInfo );
    if(FAILED(hr)) {
        ole_raise(hr, eWIN32OLEQueryInterfaceError, &quot;failed to GetTypeInfo&quot;);
    }
    type = ole_type_from_itypeinfo(pTypeInfo);
    OLE_RELEASE(pTypeInfo);
    if (type == Qnil) {
        rb_raise(rb_eRuntimeError, &quot;failed to create WIN32OLE_TYPE obj from ITypeInfo&quot;);
    }
    return type;
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="WIN32OLE.html#method-i-ole_obj_help">ole_obj_help</a>
                            </div>

                          </div>

                  <div id="method-i-ole_typelib" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          WIN32OLE#ole_typelib &rarr; The WIN32OLE_TYPELIB object
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the WIN32OLE_TYPELIB object. The object represents the type library which contains the <a href="WIN32OLE.html"><code>WIN32OLE</code></a> object.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">tlib</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">ole_typelib</span>
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">tlib</span>.<span class="ruby-identifier">name</span>  <span class="ruby-comment"># -&gt; &#39;Microsoft Excel 9.0 Object Library&#39;</span>
</pre>

                              <div class="method-source-code" id="ole_typelib-source">
            <pre>static VALUE
fole_typelib(VALUE self)
{
    struct oledata *pole = NULL;
    HRESULT hr;
    ITypeInfo *pTypeInfo;
    LCID  lcid = cWIN32OLE_lcid;
    VALUE vtlib = Qnil;

    pole = oledata_get_struct(self);
    hr = pole-&gt;pDispatch-&gt;lpVtbl-&gt;GetTypeInfo(pole-&gt;pDispatch,
                                              0, lcid, &amp;pTypeInfo);
    if(FAILED(hr)) {
        ole_raise(hr, eWIN32OLEQueryInterfaceError, &quot;failed to GetTypeInfo&quot;);
    }
    vtlib = ole_typelib_from_itypeinfo(pTypeInfo);
    OLE_RELEASE(pTypeInfo);
    if (vtlib == Qnil) {
        rb_raise(rb_eRuntimeError, &quot;failed to get type library info.&quot;);
    }
    return vtlib;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-setproperty" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          setproperty(&#39;property&#39;, [arg1, arg2,...] val)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets property of OLE object. When you want to set property with argument, you can use this method.</p>

<pre class="ruby"><span class="ruby-identifier">excel</span> = <span class="ruby-constant">WIN32OLE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;Excel.Application&#39;</span>)
<span class="ruby-identifier">excel</span>.<span class="ruby-constant">Visible</span> = <span class="ruby-keyword">true</span>
<span class="ruby-identifier">book</span> = <span class="ruby-identifier">excel</span>.<span class="ruby-identifier">workbooks</span>.<span class="ruby-identifier">add</span>
<span class="ruby-identifier">sheet</span> = <span class="ruby-identifier">book</span>.<span class="ruby-identifier">worksheets</span>(<span class="ruby-value">1</span>)
<span class="ruby-identifier">sheet</span>.<span class="ruby-identifier">setproperty</span>(<span class="ruby-string">&#39;Cells&#39;</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">10</span>) <span class="ruby-comment"># =&gt; The B1 cell value is 10.</span>
</pre>

                              <div class="method-source-code" id="setproperty-source">
            <pre>static VALUE
fole_setproperty(int argc, VALUE *argv, VALUE self)
{
    VALUE v = ole_invoke(argc, argv, self, DISPATCH_PROPERTYPUT, FALSE);
    if (v == rb_eNoMethodError) {
        return rb_call_super(argc, argv);
    }
    return v;
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-ole_methods_safely" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ole_methods_safely</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ole_methods_safely-source">
            <pre><span class="ruby-comment"># File win32ole/lib/win32ole.rb, line 27</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ole_methods_safely</span>
  <span class="ruby-identifier">ole_methods</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">WIN32OLEQueryInterfaceError</span>
  []
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

